﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;

namespace DONGTAIWANGYE
{
    public partial class WebForm4 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void txtNo_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtName_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtGender_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtAge_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtCollege_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtMemo_TextChanged(object sender, EventArgs e)
        {

        }

        protected void delete1_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder(1024);
            sb.Append("DELETE FROM Student WHERE   (No = @No) ");
            SqlParameter[] pms = new SqlParameter[6];
            pms[0] = new SqlParameter("@No", this.txtNo.Text);
            pms[1] = new SqlParameter("@Name", this.txtName.Text);
            pms[2] = new SqlParameter("@Gender", this.txtGender.Text);
            pms[3] = new SqlParameter("@Age", this.txtAge.Text);
            pms[4] = new SqlParameter("@College", this.txtCollege.Text);
            pms[5] = new SqlParameter("@Memo", this.txtMemo.Text);
            int intResult = SqlHelper.ExecuteNonQuery(sb.ToString(), pms);
            this.lblInfo.Text = (intResult < 1) ? "删除失败！" : "删除了" + intResult.ToString() + "条记录！";
        }

        protected void delete2_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder(1024);
            sb.Append("DELETE FROM Student WHERE   (Name = @Name) ");
            SqlParameter[] pms = new SqlParameter[6];
            pms[0] = new SqlParameter("@No", this.txtNo.Text);
            pms[1] = new SqlParameter("@Name", this.txtName.Text);
            pms[2] = new SqlParameter("@Gender", this.txtGender.Text);
            pms[3] = new SqlParameter("@Age", this.txtAge.Text);
            pms[4] = new SqlParameter("@College", this.txtCollege.Text);
            pms[5] = new SqlParameter("@Memo", this.txtMemo.Text);
            int intResult = SqlHelper.ExecuteNonQuery(sb.ToString(), pms);
            this.lblInfo.Text = (intResult < 1) ? "删除失败！" : "删除了" + intResult.ToString() + "条记录！";

        }

        protected void delete3_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder(1024);
            sb.Append("DELETE FROM Student WHERE   (Gender = @Gender) ");
            SqlParameter[] pms = new SqlParameter[6];
            pms[0] = new SqlParameter("@No", this.txtNo.Text);
            pms[1] = new SqlParameter("@Name", this.txtName.Text);
            pms[2] = new SqlParameter("@Gender", this.txtGender.Text);
            pms[3] = new SqlParameter("@Age", this.txtAge.Text);
            pms[4] = new SqlParameter("@College", this.txtCollege.Text);
            pms[5] = new SqlParameter("@Memo", this.txtMemo.Text);
            int intResult = SqlHelper.ExecuteNonQuery(sb.ToString(), pms);
            this.lblInfo.Text = (intResult < 1) ? "删除失败！" : "删除了" + intResult.ToString() + "条记录！";

        }

        protected void delete4_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder(1024);
            sb.Append("DELETE FROM Student WHERE   (Age = @Age) ");
            SqlParameter[] pms = new SqlParameter[6];
            pms[0] = new SqlParameter("@No", this.txtNo.Text);
            pms[1] = new SqlParameter("@Name", this.txtName.Text);
            pms[2] = new SqlParameter("@Gender", this.txtGender.Text);
            pms[3] = new SqlParameter("@Age", this.txtAge.Text);
            pms[4] = new SqlParameter("@College", this.txtCollege.Text);
            pms[5] = new SqlParameter("@Memo", this.txtMemo.Text);
            int intResult = SqlHelper.ExecuteNonQuery(sb.ToString(), pms);
            this.lblInfo.Text = (intResult < 1) ? "删除失败！" : "删除了" + intResult.ToString() + "条记录！";



        }

        protected void delete5_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder(1024);
            sb.Append("DELETE FROM Student WHERE   (College = @College) ");
            SqlParameter[] pms = new SqlParameter[6];
            pms[0] = new SqlParameter("@No", this.txtNo.Text);
            pms[1] = new SqlParameter("@Name", this.txtName.Text);
            pms[2] = new SqlParameter("@Gender", this.txtGender.Text);
            pms[3] = new SqlParameter("@Age", this.txtAge.Text);
            pms[4] = new SqlParameter("@College", this.txtCollege.Text);
            pms[5] = new SqlParameter("@Memo", this.txtMemo.Text);
            int intResult = SqlHelper.ExecuteNonQuery(sb.ToString(), pms);
            this.lblInfo.Text = (intResult < 1) ? "删除失败！" : "删除了" + intResult.ToString() + "条记录！";




        }

        protected void delete6_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder(1024);
            sb.Append("DELETE FROM Student WHERE   (Memo = @Memo) ");
            SqlParameter[] pms = new SqlParameter[6];
            pms[0] = new SqlParameter("@No", this.txtNo.Text);
            pms[1] = new SqlParameter("@Name", this.txtName.Text);
            pms[2] = new SqlParameter("@Gender", this.txtGender.Text);
            pms[3] = new SqlParameter("@Age", this.txtAge.Text);
            pms[4] = new SqlParameter("@College", this.txtCollege.Text);
            pms[5] = new SqlParameter("@Memo", this.txtMemo.Text);
            int intResult = SqlHelper.ExecuteNonQuery(sb.ToString(), pms);
            this.lblInfo.Text = (intResult < 1) ? "删除失败！" : "删除了" + intResult.ToString() + "条记录！";

        }
    }
}